//
//  ProximatorAppDelegate.h
//  Proximator
//
//  Created by Lauri Koskela on 31.7.2011.
//  Copyright (C) 2011 Lauri Koskela
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.

#import <Cocoa/Cocoa.h>

@class ProxyMenuItem;
@interface ProximatorAppDelegate : NSObject <NSApplicationDelegate, NSTextFieldDelegate> {
    NSWindow *window;
    NSArrayController *_proxyArrayController;
    NSMenu *_statusMenu;
    NSButton *_removeButton;
    ProxyMenuItem *_noProxyMenuItem;
    NSPopover *_interfacePopover;
    NSButton *_popoverButton;
    NSMatrix *_networkServiceMatrix;
    NSPersistentStoreCoordinator *__persistentStoreCoordinator;
    NSManagedObjectModel *__managedObjectModel;
    NSManagedObjectContext *__managedObjectContext;
    
    NSStatusItem *statusItem;
}

@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSArrayController *proxyArrayController;
@property (assign) IBOutlet NSMenu *statusMenu;
@property (assign) IBOutlet NSButton *removeButton;
@property (assign) IBOutlet ProxyMenuItem *noProxyMenuItem;
@property (assign) IBOutlet NSPopover *interfacePopover;
@property (assign) IBOutlet NSButton *popoverButton;
@property (assign) IBOutlet NSMatrix *networkServiceMatrix;

@property (nonatomic, retain, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (nonatomic, retain, readonly) NSManagedObjectModel *managedObjectModel;
@property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext;

- (IBAction)saveAction:(id)sender;
- (IBAction)showPreferences:(id)sender;
- (IBAction)selectProxy:(id)sender;
- (IBAction)showInterfacePopover:(id)sender;

- (void)generateMenuItems;
- (void)sortMenuItems;

- (void)generateNetworkServices;

- (void)setProxy:(NSManagedObject*)proxyObject;
- (void)setNoProxy;
@end
